intervalType is a String expression specifying the interval of time to be added. Values can be:
IntervalType value | Description |
---|---|
DateAdd returns a DateTime value to which a specified number of time intervals have been added.
DateAdd is used to add intervals of time to a DateTime. Its main feature is that the DateTime returned will always be valid. For example, DateAdd takes into account such factors as the number of days in a month and leap years. If you want to add or subtract days to a DateTime, you could use the addition and subtraction operators instead of DateAdd with the "d" parameter. However, DateAdd also handles other types of intervals such as adding months or hours to a DateTime.
The following examples are applicable to both Basic and Crystal syntax:
DateAdd("d",
Returns the DateTime value for August 27, 1999.
Returns the DateTime value for February 29, 1996. Notice that DateAdd will not return the invalid value February 31, 1996.
DateAdd ("q", 17, #Sept 28, 1999#)
Returns the DateTime value for December 28, 2003.
DateAdd ("h",
Returns the DateTime value for September 11, 1999 8:00 AM. In other words, this is the result of subtracting 400 hours from September 28, 1999 12:00 AM.
CDate(DateAdd("yyyy",
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |